(function($){
	$.entwine('ss', function($) {
		$('.ss-gridfield .action.email-link').entwine({
			onclick: function(e){
				var form = this.closest('form'), gridfield = $(this).getGridField();
				if(confirm('Are you confirm want to send these email - ' + $(this).data('subject') + '?')) {
					form.addClass('loading');
					$.get($(this).prop('href'), function(data) {
						form.removeClass('loading');
						gridfield.reload();
						alert(data);
					});
				}
				e.preventDefault();
				return false;
			}
		});
	});
}(jQuery));
